<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue basic</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
<div id="app">
    <p>{{ msg }}</p>
    <p>{{ op }}</p>
    <button @click="setmsg">set</button>
</div>
<script>
    const { isReactive, createApp, markRaw, reactive } = Vue;
    const App = {
        setup() {
            const msg = markRaw({
                value: 'markraw',
            });
            // 作为参照
            const op = reactive({
                value: 'reactive',
            });

            const setmsg = () => {
                console.log('markRaw ' + isReactive(reactive(msg))); // false
                console.log('reactive ' + isReactive(op)); // true
                msg.value = '';
                console.log(msg); // 一个普通对象
                console.log(op); // 一个经过 Proxy 加工的响应式对象
            };
            return {
                msg,
                op,
                setmsg,
            };
        },
    };

    createApp(App).mount("#app")
</script>
</body>

</html>